<template>
  <div>
    <div class="overlay">
      <div class="overlay-content scrolling">
        <van-nav-bar title="找回密码" @click-left="onClickLeft" :border="false">
          <van-icon name="arrow-left" slot="left" color="#373737" />
        </van-nav-bar>
        <div class="find-pass">
          <van-cell-group :border="false">
            <van-field placeholder="请输入手机号码" left-icon="phone-o">
              <img src="../../../assets/images/phone2.png" width="12" height="14" slot="left-icon" />
            </van-field>

            <van-field placeholder="请输入验证码" left-icon="edit">
              <img src="../../../assets/images/code.png" width="12" height="14" slot="left-icon" />
            <button
                slot="button"
                :class="disabled?'disable':'code'"
                @click="getCode"
                :disabled="disabled"
              >{{codeText}}</button>
            </van-field>
            <van-field placeholder="请输入新的密码" left-icon="lock">
              <img src="../../../assets/images/pass.png" width="12" height="14" slot="left-icon" />
             
            </van-field>
            <van-field placeholder="再次输入密码" left-icon="lock">
              <img src="../../../assets/images/pass.png" width="12" height="14" slot="left-icon" />
            </van-field>
          </van-cell-group>
          <div class="tip">两次密码不一样，请重新输入</div>
          <div class="row-justify-content">
            <van-button type="info" class="login">下一步</van-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      codeText: "获取验证码",
      disabled: false,
      currentTime: 60
    };
  },
  methods: {
    //验证码倒计时
    countDown() {
      let that = this;
      this.disabled = true;
      let currentTime = this.currentTime;
      that.codeText = "重新获取 " + currentTime + "s";
      let interval = setInterval(function() {
        let time = currentTime - 1 + "s";
        that.codeText = "重新获取 " + time;
        currentTime--;
        if (currentTime <= 0) {
          clearInterval(interval);
          (that.codeText = "发送验证码"),
            (that.currentTime = 60),
            (that.disabled = false);
        }
      }, 1000);
    },

    getCode() {
      this.countDown();
    },
    onClickLeft() {
     this.$router.go(-1)
    }
  }
};
</script>

<style lang="scss" scoped>
.van-nav-bar {
  background: #f5f5f5;

  .van-nav-bar__title {
    color: #000;
  }
}
.find-pass {
  padding: 28px 25px;
  box-sizing: border-box;
  .van-cell-group {
    div:last-child::after {
      position: absolute;
      box-sizing: border-box;
      content: " ";
      pointer-events: none;
      right: 0;
      bottom: 0;
      left: 16px;
      border-bottom: 1px solid #ebedf0;
      -webkit-transform: scaleY(0.5);
      transform: scaleY(0.5);
    }
    button {
      font-size: 10px;
      border: none;
      background: none;
    }
    .disable {
      color: #ccc !important;
    }
    .code {
      color: #3895fd;
    }
    img {
      margin-right: 10px;
      vertical-align: text-bottom;
    }
  }
  .tip {
    font-size: 10px;
    color: #666666;
    width: 172px;
    height: 20px;
    line-height: 20px;
    background: #f1efef;
    text-align: center;
    border-radius: 10px;
    margin: 0 auto;
    margin-top: 40px;
    margin-bottom: 50px;
  }
  .login {
    margin: 0 auto;
    border-radius: 20px;
    width: 171px;
    height: 40px;
  }
}
.van-cell {
      padding-top: 18px;
  padding-bottom: 2px;
}
</style>
